# It can be seen that the number, 125874, and its double, 251748, 
# contain exactly the same digits, but in a different order.
#
# Find the smallest positive integer, x, 
# such that 2x, 3x, 4x, 5x, and 6x, 
# contain the same digits.
#

#python3

import functools as ft

def go1():
	i = 0
	while 1:
		print("i: ",i)
		i+=1
		mult = [i*1, i*2, i*3, i*4, i*5, i*6]
		strmul = list(map(str, mult))
		lenmul = list(map(len, strmul))
		if ft.reduce(lambda x,y: x==y, lenmul):
			strmultord = list(map(sorted, strmul))
			if ft.reduce(lambda x,y: x==y, strmultord):
				return i




if __name__ == "__main__":
	#print( verifymagic(125874, 2)  )
	n = go()
	print("--",n)
